home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / programming / arexx / rexxbgui / list.rexx < prev    next >
OS/2 REXX Batch file  |  1999-06-14  |  2KB  |  82 lines

  1. /* REXX script for rexxbgui.library: List example */
  2.  
  3. if ~show('l','rexxbgui.library') then do
  4.     if ~addlib('rexxbgui.library',0,-30) then do
  5.         exit(20)
  6.     end
  7.     else nop
  8. end
  9. else nop
  10.  
  11. call bguiopen() /* causes error 12 if it did not work */
  12. /* supply a second argument for a '0' return code instead of an ARexx
  13.    error */
  14.  
  15. signal on syntax /* important: bguiclose() MUST be called */
  16. signal on halt
  17. signal on break_c
  18.  
  19. esc='1B'x
  20. lf='0A'x
  21. cr='0D'x
  22. grspace.narrow=-1
  23. grspace.normal=-2
  24. grspace.wide=-3
  25.  
  26. lst.count=20
  27. do i=0 for lst.count
  28.     lst.i='Entry' i+1
  29. end
  30.  
  31. /* using ARexx feature: ,<newline> is translated to nothing */
  32. /* the || are essential - any added space will cause trouble */
  33. /* redefining the same ID makes previous buttons unaccessible */
  34. /* do not redefine winclose etc. */
  35.  
  36. g=bguivgroup(,
  37.     bguiinfo(,
  38.         'info',,'cbARexx-b conversion of bList-b example',
  39.     )||bguilayout(LGO_FixMinHeight,1)||,
  40.     bguihgroup(,
  41.         bguivgroup(,
  42.             bguilistview('sslistv',,'LST','D'),
  43.         ,,'F','Single-select')||,
  44.         bguivgroup(,
  45.             bguilistview('mslistv',,'LST','D'),
  46.         ,,'F','Multi-select'),
  47.     )||,
  48.     bguihgroup(,
  49.         bguivarspace(50)||,
  50.         bguibutton('quit','_Quit')||,
  51.         bguivarspace(50),
  52.     )||bguilayout(LGO_FixMinHeight,1),
  53. ,grspace.normal,grspace.normal)
  54.  
  55. call bguiset(obj.mslistv,,LISTV_MultiSelect,1)
  56.  
  57. a=bguiwindow('Listview DragNDrop',g,50,30,,arg(1))
  58.  
  59. if bguiwinopen(a)=0 then bguierror(12)
  60. id=0
  61. do while bguiwinwaitevent(a,'ID')~=id.winclose
  62.     select
  63.         when id=id.winactive then nop
  64.         when id=id.wininactive then nop
  65.         when id=id.quit then leave
  66.         when id=id.winclose then nop
  67.         otherwise nop
  68.     end
  69. end
  70. rc=0
  71.  
  72. syntax:
  73. if rc~=0 then say '+++ ['rc']' errortext(rc) 'at line' sigl
  74. call bguiclose()
  75. exit 0
  76.  
  77. break_c:
  78. halt:
  79. rc=0
  80. say '+++ Break at line' sigl
  81. signal syntax
  82.